import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { TypeOrmConfig } from 'src/config';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { JwtModule } from '@nestjs/jwt';
import database from 'src/config/database';
import { SECRET_KEY } from 'src/constants';

@Module({
  imports: [
    TypeOrmModule.forRootAsync({
      useClass: TypeOrmConfig,
    }),
    JwtModule.register({
        global:true,
        secret: SECRET_KEY,
        signOptions:{
            expiresIn: '30d'
        }
    }),
    ConfigModule.forRoot({
      isGlobal: true,
      load: [database],
    }),
  ],
  exports: [],
  providers: [],
  controllers: [],
})
export class DbModule {}
